<%@ page import="BusinessLogic.ControllerFacade" %>
<%@ page import="static Presentation.WebUI.LinksGenerator.*" %>
<%@ page import="Domain.DataStructures.IUserData" %>
<%@ page import="java.util.Collection" %>
<%@ page errorPage="error.jsp" %>

<%
    ControllerFacade c = (ControllerFacade) session.getAttribute("c");
    IUserData user = c.getCurrentUser();    

    Collection<String> allMovies = c.getAllMovies();
    int numOfMovies = allMovies.size();
%>
<h2>Hello <%=user.getFirstname()%>, Please select any report</h2>
<table>
<tr><td>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="SearchUser" />
            <input type="hidden" name="method" value="ALL" />
            <input type="submit" value="Movies rated by User" class="reportButton" />
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="SearchMovie" />
            <input type="hidden" name="method" value="ALL" />
            <input type="hidden" name="userRated" value="true" />
            <input type="submit" value="Users gave at least X for movie M" class="reportButton" />
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="MostRatedMovies" />
            <input type="submit" value="Number of Rated movies" class="reportButton" />
            <input type="text" name="movieNumber" value="10" size="2" class="movieNumber" />
            <%="[1..."+numOfMovies+"]"%>
            <input type="radio" checked="checked" name="sort" value="most">Most
            <input type="radio" name="sort" value="least">Least
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="MovieRankingCharts" />
            <input type="submit" value="Rated Movies Chart" class="reportButton" />
            <input type="text" name="count" value="5" size="2" class="count" />
            <%="[1..."+numOfMovies+"]"%>
            <input type="radio" checked="checked" name="sort" value="most">Most
            <input type="radio" name="sort" value="least">Least
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="SearchMovie" />
            <input type="hidden" name="method" value="ALL" />
            <input type="hidden" name="showGraph" value="true" />
            <input type="submit" value="Movie rank distribution graph" class="reportButton" />
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="MostInMonth" />
            <input type="submit" value="Users rated at least" class="reportButton" />
            <input type="text" name="movieNumber" value="1" size="2" class="movieNumber" />
            <%="[1..."+numOfMovies+"]"%> movies (last month)
        </p>
    </form>
    <form action="index.jsp" method="post">
        <p class="reportPanel">
            <input type="hidden" name="action" value="LoggedInUsers" />
            <input type="submit" value="Logged In Users" class="reportButton" />
        </p>
    </form>

</td></tr>
</table>